<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="lib.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python documentation Index' />
<link rel="first" href="lib.html" title='Python library Reference' />
<link rel='contents' href='contents.html' title="Contents" />
<link rel='index' href='genindex.html' title='Index' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="prev" href="dom-example.html" />
<link rel="parent" href="module-xml.dom.minidom.html" />
<link rel="next" href="module-xml.dom.pulldom.html" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name='aesop' content='information' />
<title>8.7.3 minidom and the DOM standard </title>
</head>
<body>
<div class="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="8.7.2 dom Example"
  href="dom-example.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="8.7 xml.dom.minidom  "
  href="module-xml.dom.minidom.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="8.8 xml.dom.pulldom  "
  href="module-xml.dom.pulldom.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="dom-example.html">8.7.2 DOM Example</a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="module-xml.dom.minidom.html">8.7 xml.dom.minidom  </a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="module-xml.dom.pulldom.html">8.8 xml.dom.pulldom  </a>
</div>
<hr /></div>
</div>
<!--End of Navigation Panel-->

<h2><a name="SECTION0010730000000000000000"></a><a name="minidom-and-dom"></a>
<br>
8.7.3 minidom and the DOM standard 
</h2>

<p>
The <tt class="module"><a href="module-xml.dom.minidom.html">xml.dom.minidom</a></tt> module is essentially a DOM
1.0-compatible DOM with some DOM 2 features (primarily namespace
features).

<p>
Usage of the DOM interface in Python is straight-forward.  The
following mapping rules apply:

<p>

<ul>
<li>Interfaces are accessed through instance objects. Applications
      should not instantiate the classes themselves; they should use
      the creator functions available on the <tt class="class">Document</tt> object.
      Derived interfaces support all operations (and attributes) from
      the base interfaces, plus any new operations.

<p>
</li>
<li>Operations are used as methods. Since the DOM uses only
      <tt class="keyword">in</tt> parameters, the arguments are passed in normal
      order (from left to right).   There are no optional
      arguments. <tt class="keyword">void</tt> operations return <code>None</code>.

<p>
</li>
<li>IDL attributes map to instance attributes. For compatibility
      with the OMG IDL language mapping for Python, an attribute
      <code>foo</code> can also be accessed through accessor methods
      <tt class="method">_get_foo()</tt> and <tt class="method">_set_foo()</tt>.  <tt class="keyword">readonly</tt>
      attributes must not be changed; this is not enforced at
      runtime.

<p>
</li>
<li>The types <code>short int</code>, <code>unsigned int</code>, <code>unsigned
      long long</code>, and <code>boolean</code> all map to Python integer
      objects.

<p>
</li>
<li>The type <code>DOMString</code> maps to Python strings.
      <tt class="module"><a href="module-xml.dom.minidom.html">xml.dom.minidom</a></tt> supports either byte or Unicode
      strings, but will normally produce Unicode strings.  Values
      of type <code>DOMString</code> may also be <code>None</code> where allowed
      to have the IDL <code>null</code> value by the DOM specification from
      the W3C.

<p>
</li>
<li><tt class="keyword">const</tt> declarations map to variables in their
      respective scope
      (e.g. <code>xml.dom.minidom.Node.PROCESSING_INSTRUCTION_NODE</code>);
      they must not be changed.

<p>
</li>
<li><code>DOMException</code> is currently not supported in
      <tt class="module"><a href="module-xml.dom.minidom.html">xml.dom.minidom</a></tt>.  Instead,
      <tt class="module"><a href="module-xml.dom.minidom.html">xml.dom.minidom</a></tt> uses standard Python exceptions such
      as <tt class="exception">TypeError</tt> and <tt class="exception">AttributeError</tt>.

<p>
</li>
<li><tt class="class">NodeList</tt> objects are implemented using Python's built-in
      list type.  Starting with Python 2.2, these objects provide the
      interface defined in the DOM specification, but with earlier
      versions of Python they do not support the official API.  They
      are, however, much more ``Pythonic'' than the interface defined
      in the W3C recommendations.
</li>
</ul>

<p>
The following interfaces have no implementation in
<tt class="module"><a href="module-xml.dom.minidom.html">xml.dom.minidom</a></tt>:

<p>

<ul>
<li><tt class="class">DOMTimeStamp</tt>

<p>
</li>
<li><tt class="class">DocumentType</tt> (added in Python 2.1)

<p>
</li>
<li><tt class="class">DOMImplementation</tt> (added in Python 2.1)

<p>
</li>
<li><tt class="class">CharacterData</tt>

<p>
</li>
<li><tt class="class">CDATASection</tt>

<p>
</li>
<li><tt class="class">Notation</tt>

<p>
</li>
<li><tt class="class">Entity</tt>

<p>
</li>
<li><tt class="class">EntityReference</tt>

<p>
</li>
<li><tt class="class">DocumentFragment</tt>
</li>
</ul>

<p>
Most of these reflect information in the XML document that is not of
general utility to most DOM users.

<div class="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="8.7.2 dom Example"
  href="dom-example.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="8.7 xml.dom.minidom  "
  href="module-xml.dom.minidom.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="8.8 xml.dom.pulldom  "
  href="module-xml.dom.pulldom.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="dom-example.html">8.7.2 DOM Example</a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="module-xml.dom.minidom.html">8.7 xml.dom.minidom  </a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="module-xml.dom.pulldom.html">8.8 xml.dom.pulldom  </a>
</div>
</div>
<hr />
<span class="release-info">Release 2.5.1, documentation updated on 18th April, 2007.</span>
</div>
<!--End of Navigation Panel-->
<address>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</address>
</body>
</html>
